<?php
// email recipe
$to = "kristycaster@yahoo.com";
$subject = "Recipe from Spork";
//$subject = "Recipe from Spork: ".$response[0]['name'];
$message = "Nom, nom, nom";
//$headers = 	'From: '.F3::get('SESSION.email') . "\r\n" .
//			'Reply-To: '.F3::get('SESSION.email') . "\r\n";
$headers = "From: Kristy <kristyacaster@gmail.com>";

if(mail($to,$subject,$message,$headers)):
	header('HTTP/1.1 200');
	header("Content-Type: application/json");
	$response = "Recipe emailed.";
	echo json_encode($response);
	return;
else:
	header('HTTP/1.1 500 Internal Server Error');
	header("Content-Type: application/json");
	$err = array("error_message" => "Problem mailing recipe.");
	echo json_encode($err);
	return;
endif;
?>